package com.ht.demo.service.client;

import com.ht.demo.client.service.UserService;
import com.ht.demo.common.appexception.AppException;
import com.ht.demo.common.appexception.ResultData;
import com.ht.demo.common.pojo.bo.system.SysUserBO;
import com.ht.demo.service.manager.system.SysUserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author hdengxian
 * @Date 2023/6/29 9:03
 */
@Component
public class UserServiceImpl implements UserService {
    Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);

    @Resource
    private SysUserManager sysUserManager;

    @Override
    public SysUserBO findByUserId(Long sysUserId) throws AppException {
        try {
            SysUserBO date = sysUserManager.findByUserId(sysUserId);
            return date;
        } catch (Exception e) {
            logger.error("UserServiceImpl.findByUserId - 获取用户信息异常：e:{}", e);
        }
        return null;
    }

    @Override
    public ResultData getInfo() throws AppException {
        return sysUserManager.getInfo();
    }
}
